<template>
<div class="pulpBaseInfo">
   <el-form :inline="true" :model="pulpInfo"  :rules="dialogRules" label-width="120px" >
      <h3 class="dialog-plate-title"><span>化检项目</span></h3>
      <el-form-item label="全血比重" prop="wholeBloodLevel"><el-select v-model="pulpInfo.wholeBloodLevel" class="selectW200" :disabled="baseinfoDisabled"><el-option value="" label="【空】"></el-option><el-option v-for="item in codeData18" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
      <el-form-item label="蛋白含量"><el-input v-model="pulpInfo.proteinLevel" :disabled="baseinfoDisabled"></el-input></el-form-item>
      <el-form-item label="血清蛋白含量"><el-input v-model="pulpInfo.serumProteinLevel" :disabled="baseinfoDisabled"></el-input></el-form-item>
      <el-form-item label="血红蛋白含量" prop="hemoglobinLevel"><el-select v-model="pulpInfo.hemoglobinLevel" class="selectW200" :disabled="baseinfoDisabled"><el-option value="" label="【空】"></el-option><el-option v-for="item in codeData17" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
      <el-form-item label="HBsAg" prop="hbsAg"><el-select v-model="pulpInfo.hbsAg" class="selectW200" :disabled="baseinfoDisabled"><el-option v-for="item in codeData20" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
      <el-form-item label="抗-HCV" prop="hcv"> <el-select v-model="pulpInfo.hcv" class="selectW200" :disabled="baseinfoDisabled"><el-option v-for="item in codeData20" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
      <el-form-item label="梅毒" prop="syphilis"><el-select v-model="pulpInfo.syphilis" class="selectW200" :disabled="baseinfoDisabled"><el-option v-for="item in codeData20" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
      <el-form-item label="抗-HIV" prop="hiv"><el-select v-model="pulpInfo.hiv" class="selectW200" :disabled="baseinfoDisabled"><el-option v-for="item in codeData20" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
      <el-form-item label="ALT" prop="alt"><el-select v-model="pulpInfo.alt" class="selectW200" :disabled="baseinfoDisabled"><el-option value="" label="【空】"></el-option><el-option v-for="item in codeData21" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
      <el-form-item label="血型"  prop="bloodType"><el-select v-model="pulpInfo.bloodType" class="selectW200" :disabled="baseinfoDisabled"><el-option value="" label="【空】"></el-option><el-option v-for="item in codeData12" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
      <el-form-item label="化检备注"><el-input v-model="pulpInfo.inspectionRemark" type="textarea" class="checkNote" :rows="1" :disabled="baseinfoDisabled"></el-input></el-form-item>
      <h3 class="dialog-plate-title"><span>化检详情</span></h3>
      <el-form-item label="化检结果" prop="inspectionResult">
        <el-select v-model="pulpInfo.inspectionResult" class="selectW200" :disabled="baseinfoDisabled">
          <el-option v-for="item in inspectionResultList" :key="item.code" :value="item.code" :label="item.name"></el-option>
        </el-select>
      </el-form-item>
       <el-form-item label="不合格原因" v-if='pulpInfo.inspectionResult==="0"'>
         <el-input v-model="pulpInfo.refuseReason" :disabled="baseinfoDisabled"></el-input>
      </el-form-item>
      <el-form-item label="硫酸铜">
        <el-radio-group v-model="pulpInfo.ym" disabled>
          <el-radio label="0">液面上</el-radio>
          <el-radio label="1">液面下</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="折射仪刻度值"><el-input v-model="pulpInfo.zsykdz" disabled></el-input></el-form-item>
      <el-form-item label="记录处理时间"><el-date-picker v-model="pulpInfo.recodeEndTime" type="datetime" :disabled="baseinfoDisabled"></el-date-picker></el-form-item>
      <el-form-item label="化验开始时间"><el-date-picker v-model="pulpInfo.inspectionStartTime" type="datetime" :disabled="baseinfoDisabled"></el-date-picker></el-form-item>
      <el-form-item label="化验结束时间"><el-date-picker v-model="pulpInfo.inspectionEndTime" type="datetime" :disabled="baseinfoDisabled"></el-date-picker></el-form-item>
      <el-form-item label="化检记录人"><el-input v-model="pulpInfo.inspectionRecodePersonName" disabled></el-input></el-form-item>
      <el-form-item label="记录创建时间"><el-input v-model="pulpInfo.recodeStartTime" disabled></el-input></el-form-item>
   </el-form>
</div>
</template>
<script>
import api from 'plugins/axios/api.js';
export default {
 name: "pulpBaseInfo",
 props:{
   pulpInfo: {
      type: Object,
      required: true
    },
    baseinfoDisabled:{
       type: Boolean,
       default:false
    }
 },
 watch:{
   "pulpInfo.recodeNo":{
     handler(newValue,oldValue){
      this.formetAll();
     }
   }
 },
 data(){
    return{
      codeData12:[],
      codeData17:[],
      codeData18:[],
      codeData20:[],
      codeData21:[],
      /**化检结果列表 */
      inspectionResultList:[
        {code:'0',name:'不合格'},
        {code:'1',name:'合格'}
      ],
      dialogRules:{
        wholeBloodLevel:[ { required: true, message: '请输入全血比重', trigger: 'blur' }],
        hemoglobinLevel:[ { required: true, message: '请输入血红蛋白含量', trigger: 'blur' }],
        hbsAg:[ { required: true, message: '请输入HBsAg', trigger: 'blur' }],
        hcv:[ { required: true, message: '请输入抗-HCV', trigger: 'blur' }],
        syphilis:[ { required: true, message: '请输入梅毒', trigger: 'blur' }],
        hiv:[ { required: true, message: '请输入抗-HIV', trigger: 'blur' }],
        alt:[ { required: true, message: '请输入ALT', trigger: 'blur' }],
        bloodType:[ { required: true, message: '请输入血型', trigger: 'blur' }],
        inspectionResult:[ { required: true, message: '请输入化检结果', trigger: 'blur' }],
      }
    }
 },
 created(){
  let self = this;
  api.getCodeData(17).then(res=>{
    self.codeData12= res.content;
  })
  api.getCodeData(17).then(res=>{
    self.codeData17= res.content;
  })
  api.getCodeData(18).then(res=>{
    self.codeData18= res.content;
  })
  api.getCodeData(20).then(res=>{
    self.codeData20= res.content;
  })
  api.getCodeData(21).then(res=>{
    self.codeData21= res.content;
  })
  this.formetAll();
 },
 methods:{
   formatterChange(obj){
     return obj===null?"":String(obj)
   },
   formetAll(){
     let self =this;
      self.pulpInfo.inspectionResult= self.formatterChange(self.pulpInfo.inspectionResult);
      self.pulpInfo.ym = self.formatterChange(self.pulpInfo.ym);
      self.pulpInfo.wholeBloodLevel = self.formatterChange(self.pulpInfo.wholeBloodLevel);
      self.pulpInfo.hbsAg = self.formatterChange(self.pulpInfo.hbsAg);
      self.pulpInfo.hcv = self.formatterChange(self.pulpInfo.hcv);
      self.pulpInfo.syphilis = self.formatterChange(self.pulpInfo.syphilis );
      self.pulpInfo.hiv = self.formatterChange(self.pulpInfo.hiv)
      self.pulpInfo.alt = self.formatterChange(self.pulpInfo.alt )
      self.pulpInfo.bloodType = self.formatterChange(self.pulpInfo.bloodType);
   }
 }
}
</script>
<style lang="stylus" scoped>

</style>